package net.apexes.demo.codegen.querydsl.qvar;

import static com.querydsl.core.types.PathMetadataFactory.*;
import com.querydsl.core.types.dsl.*;

import java.sql.Types;
import javax.annotation.Generated;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.PathMetadata;
import com.querydsl.sql.ColumnMetadata;
import com.querydsl.sql.PrimaryKey;
import net.apexes.commons.querydsl.Index;
import net.apexes.demo.codegen.querydsl.entity.Pay;
import net.apexes.demo.codegen.querydsl.qvar.base.QEntityBase;

/**
 * QPay is a Querydsl query type for Pay
 */
@Generated("net.apexes.codegen.core.MetadataSerializer")
public class QPay extends QEntityBase<Pay> {

    private static final long serialVersionUID = -1148737683;

    public static final QPay $ = new QPay("PAY");

    public final StringPath name = createString("name");

    public final net.apexes.commons.querydsl.sql.EnumePath<net.apexes.demo.codegen.entity.enums.PayType> payType = createEnume("payType", net.apexes.demo.codegen.entity.enums.PayType.class);

    public final BooleanPath allowChange = createBoolean("allowChange");

    public final BooleanPath allowFavoured = createBoolean("allowFavoured");

    public final NumberPath<java.math.BigDecimal> defaultValue = createNumber("defaultValue", java.math.BigDecimal.class);

    public final StringPath templateId = createString("templateId");

    public class PrimaryKeys {

        public final PrimaryKey<Pay> constraint1 = createPrimaryKey(id);

    }

    public final PrimaryKeys pk = new PrimaryKeys();

    public class Indexs {

        public final Index primaryKey1 = index("PRIMARY_KEY_1").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public QPay(String variable) {
        super(Pay.class, forVariable(variable), "PUBLIC", "PAY");
        addMetadata();
    }

    public QPay(String variable, String schema, String table) {
        super(Pay.class, forVariable(variable), schema, table);
        addMetadata();
    }

    public QPay(Path<? extends Pay> path) {
        super(path.getType(), path.getMetadata(), "PUBLIC", "PAY");
        addMetadata();
    }

    public QPay(PathMetadata metadata) {
        super(Pay.class, metadata, "PUBLIC", "PAY");
        addMetadata();
    }

    public void addMetadata() {
        addMetadata(id, ColumnMetadata.named("ID").withIndex(1).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(name, ColumnMetadata.named("NAME").withIndex(2).ofType(Types.VARCHAR).withSize(32).notNull());
        addMetadata(payType, ColumnMetadata.named("PAY_TYPE").withIndex(3).ofType(Types.CHAR).withSize(1).notNull());
        addMetadata(allowChange, ColumnMetadata.named("ALLOW_CHANGE").withIndex(4).ofType(Types.BOOLEAN).withSize(1).notNull());
        addMetadata(allowFavoured, ColumnMetadata.named("ALLOW_FAVOURED").withIndex(5).ofType(Types.BOOLEAN).withSize(1).notNull());
        addMetadata(defaultValue, ColumnMetadata.named("DEFAULT_VALUE").withIndex(6).ofType(Types.DECIMAL).withSize(12).withDigits(3));
        addMetadata(statusFlag, ColumnMetadata.named("STATUS_FLAG").withIndex(7).ofType(Types.CHAR).withSize(1).notNull());
        addMetadata(version, ColumnMetadata.named("VERSION").withIndex(8).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(crtTime, ColumnMetadata.named("CRT_TIME").withIndex(9).ofType(Types.TIMESTAMP).withSize(26).withDigits(6).notNull());
        addMetadata(crtWho, ColumnMetadata.named("CRT_WHO").withIndex(10).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(updTime, ColumnMetadata.named("UPD_TIME").withIndex(11).ofType(Types.TIMESTAMP).withSize(26).withDigits(6));
        addMetadata(updWho, ColumnMetadata.named("UPD_WHO").withIndex(12).ofType(Types.VARCHAR).withSize(22));
        addMetadata(templateId, ColumnMetadata.named("TEMPLATE_ID").withIndex(13).ofType(Types.VARCHAR).withSize(22).notNull());
    }

    @Override
    public Pay newEntity() {
        return new Pay();
    }

    @Override
    public Object getFieldValue(Pay entity, String fieldName) {
        switch (fieldName) {
            case "id":
                return entity.getId();
            case "name":
                return entity.getName();
            case "payType":
                return entity.getPayType();
            case "allowChange":
                return entity.getAllowChange();
            case "allowFavoured":
                return entity.getAllowFavoured();
            case "defaultValue":
                return entity.getDefaultValue();
            case "statusFlag":
                return entity.getStatusFlag();
            case "version":
                return entity.getVersion();
            case "crtTime":
                return entity.getCrtTime();
            case "crtWho":
                return entity.getCrtWho();
            case "updTime":
                return entity.getUpdTime();
            case "updWho":
                return entity.getUpdWho();
            case "templateId":
                return entity.getTemplateId();
            default:
                return super.getFieldValue(entity, fieldName);
        }
    }

    @Override
    public void setFieldValue(Pay entity, String fieldName, Object value) {
        switch (fieldName) {
            case "id":
                entity.setId((java.lang.String) value);
                break;
            case "name":
                entity.setName((java.lang.String) value);
                break;
            case "payType":
                entity.setPayType((net.apexes.demo.codegen.entity.enums.PayType) value);
                break;
            case "allowChange":
                entity.setAllowChange((java.lang.Boolean) value);
                break;
            case "allowFavoured":
                entity.setAllowFavoured((java.lang.Boolean) value);
                break;
            case "defaultValue":
                entity.setDefaultValue((java.math.BigDecimal) value);
                break;
            case "statusFlag":
                entity.setStatusFlag((net.apexes.demo.codegen.entity.enums.StatusFlag) value);
                break;
            case "version":
                entity.setVersion((java.lang.String) value);
                break;
            case "crtTime":
                entity.setCrtTime((java.time.LocalDateTime) value);
                break;
            case "crtWho":
                entity.setCrtWho((java.lang.String) value);
                break;
            case "updTime":
                entity.setUpdTime((java.time.LocalDateTime) value);
                break;
            case "updWho":
                entity.setUpdWho((java.lang.String) value);
                break;
            case "templateId":
                entity.setTemplateId((java.lang.String) value);
                break;
            default:
                super.setFieldValue(entity, fieldName, value);
                break;
        }
    }

}

